package service.imppl;

import dao.ISalaryAdministrationDao;
import dao.IStaffManagementDao;
import dao.impl.SalaryAdministrationDao;
import dao.impl.StaffManagementDao;
import pojo.Employees;
import pojo.Salaries;
import pojo.SalaryDTO;
import service.ISalaryAdministrationService;
import util.PageHelper;

import java.util.ArrayList;

public class SalaryAdministrationService implements ISalaryAdministrationService {
    private ISalaryAdministrationDao isad=new SalaryAdministrationDao();
    private IStaffManagementDao ismd=new StaffManagementDao();
    //薪酬管理
    //单人薪酬修改(根据薪酬对象,员工ID)
    @Override
    public boolean updateSalary(Salaries salaries,Integer eId) {
        boolean a=isad.updateSalary(salaries,eId)>0;
        boolean b=ismd.updateSalaryById(salaries,eId)>0;
        boolean c=false;
        if(a||b){
            c=true;
        }
        return c;
    }
    /*//薪酬总览(动态模糊查询,带分页)
    @Override
    public ArrayList querySalaries(Salaries salaries,Employees employees,PageHelper pageHelper) {
        return isad.selectSalaries(salaries,employees,pageHelper);
    }*/
    @Override
    public ArrayList<SalaryDTO> querySalaries(Salaries salaries, Employees employees, PageHelper pageHelper) {
        return isad.selectSalaries(salaries, employees, pageHelper);
    }
    @Override
    public int queryCountSalaries(Salaries salaries, Employees employees) {
        return isad.getTotalCount(salaries,employees);
    }
}
